<?php

namespace App\Repositories\Transformers;

use App\Models\BranchInfo;
use League\Fractal\TransformerAbstract;

class BranchInfoListTransformer extends TransformerAbstract
{
    public function transform(BranchInfo $branchInfo)
    {
        return [
            'id' => $branchInfo->id,
            'branch_id' => $branchInfo->branch_id,
            'branch_name' => $branchInfo->branch->name ?? '',
            'title' => $branchInfo->title,
            'image' => $branchInfo->image,
            'created_at' => $branchInfo->created_at != null ? $branchInfo->created_at->toDateTimeString() : null,
        ];
    }
}
